<template>
  <div class="form">
    <el-form label-position="top" label-width="80px" :model="menuForm">
      <el-form-item label="类型">
        <el-input v-model="menuForm.type"></el-input>
      </el-form-item>

      <el-form-item label="字典编码">
        <el-input v-model="menuForm.code"></el-input>
      </el-form-item>

      <el-form-item label="字典名称">
        <el-input v-model="menuForm.displayName"></el-input>
      </el-form-item>

      <el-form-item label="父编码">
        <el-input v-model="menuForm.parentCode"></el-input>
      </el-form-item>

      <el-form-item label="排序">
        <el-input-number v-model="menuForm.seq"  :min="0"  label="排序" controls-position="right"></el-input-number>
      </el-form-item>

      <div style="text-align: right;">
        <el-form-item>
          <el-button type="primary" @click="onAdd">保存</el-button>
          <el-button @click="onClose">取消</el-button>
        </el-form-item>
      </div>
    </el-form>
  </div>
</template>

<script>
import api from '@/api'

export default {
  name: 'curd-query-add',
  components: {
  },
  props: {
  },
  data () {
    return {
      menuForm: {
        seq: 0,
        parentCode: 0
      },
      randomKey: 0
    }
  },
  mounted () {
  },
  methods: {
    onAdd () {
      var param = this.menuForm
      api.sysDict.sysDictInsert(param).then(res => {
        this.$message({ type: 'info', message: '已添加' })
        this.onClose()
        this.$emit('refresh')
      })
    },
    onClose () {
      this.$emit('closeDrawer')
    }
  }
}
</script>

<style lang="scss">
  .form {
    padding: 10px;
  }
</style>
